package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/09/10 23:19
 **/
public class Day8_6_Num240_SearchMatrix {
    class Solution {
        public boolean searchMatrix(int[][] matrix, int target) {
            int i = 0, j = matrix[0].length-1;
            while(i < matrix.length && j >= 0){
                if(target < matrix[i][j]){
                    j--;
                }else if(target > matrix[i][j]){
                    i++;
                }else {
                    return true;
                }
            }
            return false;
        }
    }
}